package utilities
{
	/**
	 * ...
	 * @author Leong Shi Yun, 2012
	 */
	public class Keys
	{
		/***** uint values *****/
		public static const KEYS_SIZE:uint 			= 256;
		
		/* Number keys */
		public static const NUM_0:uint				= 48;
		public static const NUM_1:uint				= 49;
		public static const NUM_2:uint				= 50;
		public static const NUM_3:uint				= 51;
		public static const NUM_4:uint				= 52;
		public static const NUM_5:uint				= 53;
		public static const NUM_6:uint				= 54;
		public static const NUM_7:uint				= 55;
		public static const NUM_8:uint				= 56;
		public static const NUM_9:uint				= 57;
		
		/* Alphabet Keys */
		public static const A:uint					= 65;
		public static const B:uint					= 66;
		public static const C:uint					= 67;
		public static const D:uint					= 68;
		public static const E:uint					= 69;
		public static const F:uint					= 70;
		public static const G:uint					= 71;
		public static const H:uint					= 72;
		public static const I:uint					= 73;
		public static const J:uint					= 74;
		public static const K:uint					= 75;
		public static const L:uint					= 76;
		public static const M:uint					= 77;
		public static const N:uint					= 78;
		public static const O:uint					= 79;
		public static const P:uint					= 80;
		public static const Q:uint					= 81;
		public static const R:uint					= 82;
		public static const S:uint					= 83;
		public static const T:uint					= 84;
		public static const U:uint					= 85;
		public static const V:uint					= 86;
		public static const W:uint					= 87;
		public static const X:uint					= 88;
		public static const Y:uint					= 89;
		public static const Z:uint					= 90;
		
		/* Punctuation Keys */
		public static const BACKQUOTE:uint			= 192;
		public static const BACKSLASH:uint			= 220;
		
		public static const COMMA:int				= 188;
		
		public static const EQUAL:uint				= 187;
		
		public static const LEFTBRACKET:uint		= 219;
		public static const RIGHTBRACKET:uint		= 221;
		
		public static const MINUS:uint				= 189;
		
		public static const QUOTE:uint				= 222;
		
		public static const SEMICOLON:uint			= 186;
		
		public static const SLASH:uint				= 191;
		
		public static const PERIOD:uint				= 190;
		
		/* Function Keys */
		public static const F1:uint					= 112;
		public static const F2:uint					= 113;
		public static const F3:uint					= 114;
		public static const F4:uint					= 115;
		public static const F5:uint					= 116;
		public static const F6:uint					= 117;
		public static const F7:uint					= 118;
		public static const F8:uint					= 119;
		public static const F9:uint					= 120;
		public static const F10:uint				= 121;
		public static const F11:uint				= 122;
		public static const F12:uint				= 123;
		
		/* Arrow Keys */
		public static const LEFT:uint				= 37;
		public static const UP:uint					= 38;
		public static const RIGHT:uint				= 39;
		public static const DOWN:uint				= 40;
		
		/* Numpad Keys */
		public static const NUMPAD_0:uint			= 96;
		public static const NUMPAD_1:uint			= 97;
		public static const NUMPAD_2:uint			= 98;
		public static const NUMPAD_3:uint			= 99;
		public static const NUMPAD_4:uint			= 100;
		public static const NUMPAD_5:uint			= 101;
		public static const NUMPAD_6:uint			= 102;
		public static const NUMPAD_7:uint			= 103;
		public static const NUMPAD_8:uint			= 104;
		public static const NUMPAD_9:uint			= 105;
		public static const NUMPAD_MULTIPLY:uint	= 106;
		public static const NUMPAD_ADD:uint		= 107;
		public static const NUMPAD_ENTER:uint		= 108;
		public static const NUMPAD_SUBTRACT:uint	= 109;
		public static const NUMPAD_DECIMAL:uint		= 110;
		public static const NUMPAD_DIVIDE:uint		= 111;
		
		/* Lock Keys */
		public static const CAPS_LOCK:uint			= 20;
		
		/* Other Keys */
		public static const ALT:uint				= 18;
		public static const ALTERNATE:uint			= 18;
		public static const COMMAND:uint			= 15;
		
		public static const BACKSPACE:uint			= 8;
		
		public static const CNTL:uint				= 17;
		public static const CNTRL:uint				= 17;
		public static const CONTROL:uint			= 17;
				
		public static const ESC:uint				= 27;
		public static const ESCAPE:uint				= 27;
		
		public static const ENTER:uint				= 13;
		public static const RETURN:uint				= 13;
		
		public static const SHIFT:uint				= 16;
		public static const SPACE:uint				= 32;
		
		public static const TAB:uint				= 9;
		
		public static const PAGE_UP:uint			= 33;
		public static const PAGE_DOWN:uint			= 34;
		public static const END:uint				= 35;
		public static const HOME:uint				= 36;
		public static const INSERT:uint				= 45;
		public static const DELETE:uint				= 46;
		
		/**
		 * GetKeyName gets the keycode of the key and returns the name of the key
		 * being checked.
		 *
		 * @param	uiName:uint is the keycode of the key being checked
		 * @return	the name of the key beig checked
		 */
		public static function getKeyName(uiKey:uint):String
		{
			switch(uiKey)
			{
				// start: numeric keys
				case NUM_0:
				return "0 Key";
				break;
				
				case NUM_1:
				return "1 Key";
				break;
				
				case NUM_2:
				return "2 Key";
				break;
				
				case NUM_3:
				return "3 Key";
				break;
				
				case NUM_4:
				return "4 Key";
				break;
				
				case NUM_5:
				return "5 Key";
				break;
				
				case NUM_6:
				return "6 Key";
				break;
				
				case NUM_7:
				return "7 Key";
				break;
				
				case NUM_8:
				return "8 Key";
				break;
				
				case NUM_9:
				return "9 Key";
				break;
				// end: numeric keys
				
				// start: numpad keys
				case NUMPAD_0:
				return "NUMPAD 0 Key";
				break;
				
				case NUMPAD_1:
				return "NUMPAD 1 Key";
				break;
				
				case NUMPAD_2:
				return "NUMPAD 2 Key";
				break;
				
				case NUMPAD_3:
				return "NUMPAD 3 Key";
				break;
				
				case NUMPAD_4:
				return "NUMPAD 4 Key";
				break;
				
				case NUMPAD_5:
				return "NUMPAD 5 Key";
				break;
				
				case NUMPAD_6:
				return "NUMPAD 6 Key";
				break;
				
				case NUMPAD_7:
				return "NUMPAD 7 Key";
				break;
				
				case NUMPAD_8:
				return "NUMPAD 8 Key";
				break;
				
				case NUMPAD_9:
				return "NUMPAD 9 Key";
				break;
				
				case NUMPAD_MULTIPLY:
				return "NUMPAD * Key";
				break;
				
				case NUMPAD_ADD:
				return "NUMPAD + Key";
				break;
				
				case NUMPAD_ENTER:
				return "NUMPAD enter Key";
				break;
				
				case NUMPAD_SUBTRACT:
				return "NUMPAD - Key";
				break;
				
				case NUMPAD_DECIMAL:
				return "NUMPAD . Key";
				break;
				
				case NUMPAD_DIVIDE:
				return "NUMPAD / Key";
				break;
				// end: numpad keys
				
				// start: function keys
				case F1:
				return "F1 Key";
				break;
				
				case F2:
				return "F2 Key";
				break;
				
				case F3:
				return "F3 Key";
				break;
				
				case F4:
				return "F4 Key";
				break;
				
				case F5:
				return "F5 Key";
				break;
				
				case F6:
				return "F6 Key";
				break;
				
				case F7:
				return "F7 Key";
				break;
				
				case F8:
				return "F8 Key";
				break;
				
				case F9:
				return "F9 Key";
				break;
				
				case F10:
				return "F10 Key";
				break;
				
				case F11:
				return "F11 Key";
				break;
				
				case F12:
				return "F12 Key";
				break;
				// end: function keys
				
				// start: alphabet keys
				case A:
				return "A Key";
				break
				
				case B:
				return "B Key";
				break
				
				case C:
				return "C Key";
				break
				
				case D:
				return "D Key";
				break
				
				case E:
				return "E Key";
				break
				
				case F:
				return "F Key";
				break
				
				case G:
				return "G Key";
				break
				
				case H:
				return "H Key";
				break
				
				case I:
				return "I Key";
				break
				
				case J:
				return "J Key";
				break
				
				case K:
				return "K Key";
				break
				
				case L:
				return "L Key";
				break
				
				case M:
				return "M Key";
				break
				
				case N:
				return "N Key";
				break
				
				case O:
				return "O Key";
				break
				
				case P:
				return "P Key";
				break
				
				case Q:
				return "Q Key";
				break
				
				case R:
				return "R Key";
				break
				
				case S:
				return "S Key";
				break
				
				case T:
				return "T Key";
				break
				
				case U:
				return "U Key";
				break
				
				case V:
				return "V Key";
				break
				
				case W:
				return "W Key";
				break
				
				case X:
				return "X Key";
				break
				
				case Y:
				return "Y Key";
				break
				
				case Z:
				return "Z Key";
				break;
				// end: alphabet keys
				
				// start: arrow keys
				case LEFT:
				return "Left Key";
				break;
				
				case UP:
				return "Up Key";
				break;
				
				case RIGHT:
				return "Right Key";
				break;
				
				case DOWN:
				return "Down Key";
				break;
				// end: arrow keys
				
				// start: punctuation keys
				case BACKQUOTE:
				return "` Key";
				break;
				
				case BACKSLASH:
				return "\\ Key";
				break;
				
				case COMMA:
				return ", Key";
				break;
				
				case EQUAL:
				return "= Key";
				break;
				
				case LEFTBRACKET:
				return "[ Key";
				break;
				
				case RIGHTBRACKET:
				return "] Key";
				break;
				
				case QUOTE:
				return "\' Key";
				break;
				
				case SEMICOLON:
				return "; Key";
				break;
				
				case SLASH:
				return "/ Key";
				break;
				
				case PERIOD:
				return ". Key";
				break;
				
				case MINUS:
				return "- key";
				break;
				// end: punctuation keys
				
				// start: other keys
				case CAPS_LOCK:
				return "Caps Lock Key";
				break;
				
				case RETURN:
				case ENTER:
				return "Enter Key";
				break;
				
				case ALTERNATE:
				case ALT:
				return "Alt Key";
				break;
				
				case SHIFT:
				return "Shift Key";
				break;
				
				case COMMAND:
				return "Command Key";
				
				case CONTROL:
				case CNTRL:
				case CNTL:
				return "Control Key";
				break;
				
				case ESCAPE:
				case ESC:
				return "Escape Key";
				break;
				
				case BACKSPACE:
				return "Backspace Key";
				break;
				
				case TAB:
				return "Tab Key";
				break;
				
				case DELETE:
				return "Delete Key";
				break;
				
				case END:
				return "End Key";
				break;
				
				case HOME:
				return "Home Key";
				break;
				
				case INSERT:
				return "Insert Key";
				break;
				
				case PAGE_DOWN:
				return "Page Down Key";
				break;
				
				case PAGE_UP:
				return "Page Up Key";
				break;
				
				case SPACE:
				return "Space Key";
				break;
				// end: other keys
				
				default:
				return "Key Undefined!";
				break;
			}
			
			return "";
		}
		
	}

}